<div id="<?php echo $v['m']?>_ilp" class="easyui-panel" title="<?php echo $v['t']?> 高级搜索" style="height:130px;padding:10px;background:#fafafa; overflow:hidden"
        data-options="iconCls:'icon-search',closable:true,border:false,fit:true">
	<p>	标　　题: <input id="<?php echo $v['m']?>_advanced_search_key" class="easyui-textbox" type="text" style="width:300px;">&nbsp;&nbsp;&nbsp;&nbsp;
    <?php echo ($v['m'] == 'email_in')?'发 送 人':'收 件 人';?>: <input id="<?php echo $v['m']?>_search_select_user" class="textbox" type="text" style="width:200px; cursor:pointer;" onclick="selectuser_fun('选择用户','<?php echo $v['m']?>_search')"></p>
    <p>
    开始时间: <input id="<?php echo $v['m']?>_ids" class="easyui-datebox" editable="false" data-options="sharedCalendar:'#<?php echo $v['m']?>_id'">&nbsp;&nbsp;&nbsp;&nbsp;
    结束时间: <input id="<?php echo $v['m']?>_ide" class="easyui-datebox" editable="false" data-options="sharedCalendar:'#<?php echo $v['m']?>_id'">&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-search" onclick="email_search_submit('<?php echo $v['m']?>')">搜索</a>
    <input id="<?php echo $v['m']?>_search_select_id" type="hidden">
    </p><div id="<?php echo $v['m']?>_id" class="easyui-calendar"></div>
</div>
    
<script>
$('#<?php echo $v['m']?>_ilp').panel({//关闭面板同时执行关闭搜索区域操作
    onClose:function(){
        removePanel('<?php echo $v['m']?>');
    }
});

$('#<?php echo $v['m']?>_ids').datebox({
	onSelect: function (date) {
		var now = new Date();
        var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate());
		if(date>d1){
			$('#<?php echo $v['m']?>_ids').datebox('setValue', '');	// set datebox value
			$.messager.alert('警告','开始日期不能大于当前日期','warning');
		}
	}
});
$('#<?php echo $v['m']?>_ide').datebox({
	onSelect: function (date) {
		var now = new Date();
        var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate());
		if(date>d1){
			$('#<?php echo $v['m']?>_ide').datebox('setValue', '');	// set datebox value
			$.messager.alert('警告','结束日期不能大于当前日期','warning');
		}
		var eids = $("#<?php echo $v['m']?>_ids").datebox('getValue');
		var newDt=new Date(eids.replace("-","/")); 
		if(eids != '' && date<newDt){
			$('#<?php echo $v['m']?>_ide').datebox('setValue', '');	// set datebox value
			$.messager.alert('警告','结束日期不能小于开始日期','warning');
		}
	}
});

/*		
function einsearch(v){//刷新两个区域，并定义标题和插入位置，弹出人员选择窗口，
	$('#selectuser_tree').tree('reload');
	$('#selectuser_list').datagrid('reload');
	destination_id = v;
	$('#selectuser_dd').dialog({
		title: '选择用户'
	});
	$('#selectuser_dd').window('open');
}
*/
function email_search_submit(m){
	var queryParams = $('#'+m+'_list').datagrid('options').queryParams;  
		if($("#"+m+"_advanced_search_key").val())
			queryParams.title = $("#"+m+"_advanced_search_key").val();
		else
			delete queryParams.title;
		if($("#"+m+"_search_select_user").val())
			queryParams.sendname = $("#"+m+"_search_select_user").val();
		else
			delete queryParams.sendname;
		if($("#"+m+"_ids").datebox('getValue'))
			queryParams.eids = $("#"+m+"_ids").datebox('getValue');
		else
			delete queryParams.eids;
		if($("#"+m+"_ide").datebox('getValue'))
			queryParams.eide = $("#"+m+"_ide").datebox('getValue');
		else
			delete queryParams.eide;

	$('#'+m+'_list').datagrid('options').queryParams=queryParams;        
	$('#'+m+'_list').datagrid('reload'); 

/*
	$.post("<?php echo base_url('email/search_submit');?>",{
		key:$("#e_advanced_search_key").val(),
		sendname:$("#email_add_sendsearch_select_id").val(),
		eids:$("#eids").datebox('getValue'),
		eide:$("#eide").datebox('getValue')
	},function(result){
		if(result.success){
			var queryParams = $('#emaillist').datagrid('options').queryParams;  
			queryParams.state = stateVal;
			$('#test').datagrid('options').queryParams=queryParams;        
			$("#test").datagrid('reload'); 
		}else{
			$.messager.alert('错误',result.errorMsg,'error');
		}
	},'json');	
*/
}
</script>